package com.after.saas.system.controller;

import com.after.saas.client.service.RemoteUserService;
import com.after.saas.common.constants.Result;
import com.after.saas.common.model.query.UserQuery;
import com.after.saas.common.model.vo.UserVO;
import com.after.saas.common.utils.ResponseUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Classname PubController
 * @Description TODO
 * @auth after
 * @since 2021/8/14 19:06
 */

@RestController
@RequestMapping("/pub")
public class PubController {

    @Autowired
    private RemoteUserService remoteUserService;

    @PostMapping("/getAllUser")
    public Result<Page<UserVO>> listUserByPage(@RequestBody UserQuery query) {
        return remoteUserService.queryByPage(query);
    }

    @GetMapping("/getById")
    public Result<UserVO> getById(@RequestParam(value = "id") Long id) {
        return remoteUserService.findById(id);
    }

     @GetMapping("/getOne")
    public Result<UserVO> getOne(UserQuery userQuery) {
        return remoteUserService.findOne(userQuery);
    }


}
